package server.ejb.beans;


import java.io.Serializable;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;

@Entity	
@NamedQuery(name = "Konto.findAll", query = "SELECT k FROM Konto k")
public class Konto implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue
	private int KontoId;
	@OneToMany
	private List<Buchung> buchungen;
	@Basic
	private String bemerkung;

	public int getKontoId() {
		return KontoId;
	}

	public List<Buchung> getBuchungen() {
		return buchungen;
	}

	public void setBuchungen(List<Buchung> buchungen) {
		this.buchungen = buchungen;
	}

	public String getBemerkung() {
		return bemerkung;
	}

	public void setBemerkung(String bemerkung) {
		this.bemerkung = bemerkung;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + KontoId;
		result = prime * result
				+ ((bemerkung == null) ? 0 : bemerkung.hashCode());
		result = prime * result
				+ ((buchungen == null) ? 0 : buchungen.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Konto other = (Konto) obj;
		if (KontoId != other.KontoId)
			return false;
		if (bemerkung == null) {
			if (other.bemerkung != null)
				return false;
		} else if (!bemerkung.equals(other.bemerkung))
			return false;
		if (buchungen == null) {
			if (other.buchungen != null)
				return false;
		} else if (!buchungen.equals(other.buchungen))
			return false;
		return true;
	}

}
